/*
 * Selling Partner API for Orders
 *
 * Use the Orders Selling Partner API to programmatically retrieve order information. With this API, you can develop fast, flexible, and custom applications to manage order synchronization, perform order research, and create demand-based decision support tools.   _Note:_ For the JP, AU, and SG marketplaces, the Orders API supports orders from 2016 onward. For all other marketplaces, the Orders API supports orders for the last two years (orders older than this don't show up in the response).
 *
 * The version of the OpenAPI document: v0
 * Generated by: https://github.com/openapitools/openapi-generator.git
 */


using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = software.amzn.spapi.Client.OpenAPIDateConverter;

namespace software.amzn.spapi.Model.orders.v0
{
    /// <summary>
    /// Properties of packages
    /// </summary>
    [DataContract(Name = "PackageDetail")]
    public partial class PackageDetail : IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="PackageDetail" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected PackageDetail() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="PackageDetail" /> class.
        /// </summary>
        /// <param name="packageReferenceId">A seller-supplied identifier that uniquely identifies a package within the scope of an order. Only positive numeric values are supported. (required).</param>
        /// <param name="carrierCode">Identifies the carrier that will deliver the package. This field is required for all marketplaces. For more information, refer to the [&#x60;CarrierCode&#x60; announcement](https://developer-docs.amazon.com/sp-api/changelog/carriercode-value-required-in-shipment-confirmations-for-br-mx-ca-sg-au-in-jp-marketplaces). (required).</param>
        /// <param name="carrierName">Carrier name that will deliver the package. Required when &#x60;carrierCode&#x60; is \&quot;Other\&quot; .</param>
        /// <param name="shippingMethod">Ship method to be used for shipping the order..</param>
        /// <param name="trackingNumber">The tracking number used to obtain tracking and delivery information. (required).</param>
        /// <param name="shipDate">The shipping date for the package. Must be in &lt;a href&#x3D;&#39;https://developer-docs.amazon.com/sp-api/docs/iso-8601&#39;&gt;ISO 8601&lt;/a&gt; date/time format. (required).</param>
        /// <param name="shipFromSupplySourceId">The unique identifier for the supply source..</param>
        /// <param name="orderItems">A list of order items. (required).</param>
        public PackageDetail(string packageReferenceId = default(string), string carrierCode = default(string), string carrierName = default(string), string shippingMethod = default(string), string trackingNumber = default(string), DateTime shipDate = default(DateTime), string shipFromSupplySourceId = default(string), List<ConfirmShipmentOrderItem> orderItems = default(List<ConfirmShipmentOrderItem>))
        {
            // to ensure "packageReferenceId" is required (not null)
            if (packageReferenceId == null)
            {
                throw new ArgumentNullException("packageReferenceId is a required property for PackageDetail and cannot be null");
            }
            this.PackageReferenceId = packageReferenceId;
            // to ensure "carrierCode" is required (not null)
            if (carrierCode == null)
            {
                throw new ArgumentNullException("carrierCode is a required property for PackageDetail and cannot be null");
            }
            this.CarrierCode = carrierCode;
            // to ensure "trackingNumber" is required (not null)
            if (trackingNumber == null)
            {
                throw new ArgumentNullException("trackingNumber is a required property for PackageDetail and cannot be null");
            }
            this.TrackingNumber = trackingNumber;
            this.ShipDate = shipDate;
            // to ensure "orderItems" is required (not null)
            if (orderItems == null)
            {
                throw new ArgumentNullException("orderItems is a required property for PackageDetail and cannot be null");
            }
            this.OrderItems = orderItems;
            this.CarrierName = carrierName;
            this.ShippingMethod = shippingMethod;
            this.ShipFromSupplySourceId = shipFromSupplySourceId;
        }

        /// <summary>
        /// A seller-supplied identifier that uniquely identifies a package within the scope of an order. Only positive numeric values are supported.
        /// </summary>
        /// <value>A seller-supplied identifier that uniquely identifies a package within the scope of an order. Only positive numeric values are supported.</value>
        [DataMember(Name = "packageReferenceId", IsRequired = true, EmitDefaultValue = true)]
        public string PackageReferenceId { get; set; }

        /// <summary>
        /// Identifies the carrier that will deliver the package. This field is required for all marketplaces. For more information, refer to the [&#x60;CarrierCode&#x60; announcement](https://developer-docs.amazon.com/sp-api/changelog/carriercode-value-required-in-shipment-confirmations-for-br-mx-ca-sg-au-in-jp-marketplaces).
        /// </summary>
        /// <value>Identifies the carrier that will deliver the package. This field is required for all marketplaces. For more information, refer to the [&#x60;CarrierCode&#x60; announcement](https://developer-docs.amazon.com/sp-api/changelog/carriercode-value-required-in-shipment-confirmations-for-br-mx-ca-sg-au-in-jp-marketplaces).</value>
        [DataMember(Name = "carrierCode", IsRequired = true, EmitDefaultValue = true)]
        public string CarrierCode { get; set; }

        /// <summary>
        /// Carrier name that will deliver the package. Required when &#x60;carrierCode&#x60; is \&quot;Other\&quot; 
        /// </summary>
        /// <value>Carrier name that will deliver the package. Required when &#x60;carrierCode&#x60; is \&quot;Other\&quot; </value>
        [DataMember(Name = "carrierName", EmitDefaultValue = false)]
        public string CarrierName { get; set; }

        /// <summary>
        /// Ship method to be used for shipping the order.
        /// </summary>
        /// <value>Ship method to be used for shipping the order.</value>
        [DataMember(Name = "shippingMethod", EmitDefaultValue = false)]
        public string ShippingMethod { get; set; }

        /// <summary>
        /// The tracking number used to obtain tracking and delivery information.
        /// </summary>
        /// <value>The tracking number used to obtain tracking and delivery information.</value>
        [DataMember(Name = "trackingNumber", IsRequired = true, EmitDefaultValue = true)]
        public string TrackingNumber { get; set; }

        /// <summary>
        /// The shipping date for the package. Must be in &lt;a href&#x3D;&#39;https://developer-docs.amazon.com/sp-api/docs/iso-8601&#39;&gt;ISO 8601&lt;/a&gt; date/time format.
        /// </summary>
        /// <value>The shipping date for the package. Must be in &lt;a href&#x3D;&#39;https://developer-docs.amazon.com/sp-api/docs/iso-8601&#39;&gt;ISO 8601&lt;/a&gt; date/time format.</value>
        [DataMember(Name = "shipDate", IsRequired = true, EmitDefaultValue = true)]
        public DateTime ShipDate { get; set; }

        /// <summary>
        /// The unique identifier for the supply source.
        /// </summary>
        /// <value>The unique identifier for the supply source.</value>
        [DataMember(Name = "shipFromSupplySourceId", EmitDefaultValue = false)]
        public string ShipFromSupplySourceId { get; set; }

        /// <summary>
        /// A list of order items.
        /// </summary>
        /// <value>A list of order items.</value>
        [DataMember(Name = "orderItems", IsRequired = true, EmitDefaultValue = true)]
        public List<ConfirmShipmentOrderItem> OrderItems { get; set; }

        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("class PackageDetail {\n");
            sb.Append("  PackageReferenceId: ").Append(PackageReferenceId).Append("\n");
            sb.Append("  CarrierCode: ").Append(CarrierCode).Append("\n");
            sb.Append("  CarrierName: ").Append(CarrierName).Append("\n");
            sb.Append("  ShippingMethod: ").Append(ShippingMethod).Append("\n");
            sb.Append("  TrackingNumber: ").Append(TrackingNumber).Append("\n");
            sb.Append("  ShipDate: ").Append(ShipDate).Append("\n");
            sb.Append("  ShipFromSupplySourceId: ").Append(ShipFromSupplySourceId).Append("\n");
            sb.Append("  OrderItems: ").Append(OrderItems).Append("\n");
            sb.Append("}\n");
            return sb.ToString();
        }

        /// <summary>
        /// Returns the JSON string presentation of the object
        /// </summary>
        /// <returns>JSON string presentation of the object</returns>
        public virtual string ToJson()
        {
            return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
        }

        /// <summary>
        /// To validate all properties of the instance
        /// </summary>
        /// <param name="validationContext">Validation context</param>
        /// <returns>Validation Result</returns>
        IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
        {
            yield break;
        }
    }

}
